package com.yao.smy.controller;

import com.yao.smy.service.DeviceScannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 设备扫描控制器
 */
@RestController
@RequestMapping("/devices")
public class DeviceScannerController {

    @Autowired
    private DeviceScannerService deviceScannerService;

    /**
     * 获取局域网内的在线设备列表
     * @return 在线设备的IP地址列表
     */
    @GetMapping("/scan")
    public List<String> scanDevices() {
        return deviceScannerService.getOnlineDevices();
    }
}
